﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LibNiconico.NiconicoApi.Utils
{
    /// <summary>
    /// チャットコメントユーザタイプ
    /// </summary>
    public enum NicoChatCommentUserType
    {
        /// <summary>
        /// 設定なし
        /// </summary>
        None,

        /// <summary>
        /// 一般
        /// </summary>
        General,

        /// <summary>
        /// プレミアム
        /// </summary>
        Premium,

        /// <summary>
        /// アラート
        /// </summary>
        Alert,

        /// <summary>
        /// 放送主
        /// </summary>
        Owner,

        /// <summary>
        /// 運営
        /// </summary>
        Manager,


        /// <summary>
        /// 未定義のコード
        /// </summary>
        Undefined,

    }


    /// <summary>
    /// チャットコメントユーザ
    /// </summary>
    public class NicoChatCommentUser
    {
        internal NicoChatCommentUser(NicoChatCommentUserType userType, int baseUserType)
        {
            this.UserType = userType;
            this.baseUserType = baseUserType;
        }

        /// <summary>
        /// ユーザタイプ
        /// </summary>
        public NicoChatCommentUserType UserType { get; private set; }

        private int baseUserType;


        /// <summary>
        /// APIから取得した元のコードを取得
        /// </summary>
        /// <returns></returns>
        public int GetBaseUserType()
        {
            return baseUserType;
        }

        internal static NicoChatCommentUser Craete(int baseUserType)
        {
            switch (baseUserType)
            {
                case 0:
                    return new NicoChatCommentUser(NicoChatCommentUserType.General, baseUserType);

                case 1:
                    return new NicoChatCommentUser(NicoChatCommentUserType.Premium, baseUserType);

                case 2:
                    return new NicoChatCommentUser(NicoChatCommentUserType.Alert, baseUserType);

                case 3:
                    return new NicoChatCommentUser(NicoChatCommentUserType.Owner, baseUserType);

                case 6:
                    return new NicoChatCommentUser(NicoChatCommentUserType.Manager, baseUserType);

                default:
                    return new NicoChatCommentUser(NicoChatCommentUserType.Undefined, baseUserType);
            }
        }
    }
}
